<?php
declare (strict_types = 1);

namespace ui;

/**
 * 
 */
class MessageBox {
    public const TYPE_CONFIRM = 'CONFIRM';

    public const METHOD_POST = 'POST';

    private $type = '';

    private $method = '';

    private $title = '提示';

    private $content = '';

    public static function createConfirm() {
        $box = new self();
        $box->type = self::TYPE_CONFIRM;
        return $box;
    }

    public function setMethodPost($url) {
        $this->method = self::METHOD_POST;
        $this->url = $url;
        return $this;
    }

    public function setContent($content) {
        $this->content = $content;
        return $this;
    }

    public function build() {
        return [
            'type' => $this->type,
            'method' => $this->method,
            'url' => $this->url,
            'title' => $this->title,
            'content' => $this->content,
        ];
    }
}